package com.jiayan.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jiayan.mapper.EbUserMapper;
import com.jiayan.model.EbUser;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class EbUserService {
    @Resource
    public EbUserMapper ebUserMapper;

    public EbUser login(String username,String password){
        EbUser lgUser=ebUserMapper.selectOne(new QueryWrapper<EbUser>()
                .eq("eu_user_id",username)
                .eq("eu_password",password)
                );
        return lgUser;
    }
    /**
     * @param name
     * @param password
     */
    public int Insert(String name,String password,String address){
        EbUser ebUser = new EbUser();
        ebUser.setEuUserId(name);
        ebUser.setEuUserName(name);
        ebUser.setEuAddress(address);
        ebUser.setEuPassword(password);
        ebUser.setEuBirthday(new Date());
        ebUser.setEuSex("T");
        ebUser.setEuStatus(1);
        int num = ebUserMapper.insert(ebUser);
        return num;
    }
}
